<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="java.util.Date,java.text.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改人员信息</title>
</head>
<% 
int number =0;
if(application.getAttribute("number") == null)
{
	number=1;
}
else
{
	number=Integer.parseInt((String)application.getAttribute("number"));
	if(session.isNew())
	{
		number=number+1;
	}
}
out.println("<center><h1>这是您第"+number+"次访问此页面！</h1></center>");
application.setAttribute("number",String.valueOf(number));
%>
<br>

<%
	Date nowday = new Date();
	int hour = nowday.getHours();
	SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	String time = format.format(nowday);
%>
<center><h1>现在时间为<%=time%></h1></center>
<body>
<%
Connection con = null;
Statement st =null;
ResultSet rs = null;
try{
	Class.forName("com.mysql.jdbc.Driver");
	con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","lishanshan");
	st=con.createStatement();
	request.setCharacterEncoding("UTF-8");
	int id=(Integer.parseInt(request.getParameter("id")));
	String sql ="select * from person where id='"+id+"'";
	rs= st.executeQuery(sql);
	if(rs.next()){
		request.setAttribute("id",rs.getInt("id"));
		request.setAttribute("name",rs.getString("name"));
		request.setAttribute("sex",rs.getString("sex"));
		request.setAttribute("age",rs.getInt("age"));
		request.setAttribute("birthday",rs.getString("birthday"));
		request.setAttribute("descriptions",rs.getString("descriptions"));
		request.setAttribute("juese",rs.getString("juese"));
		RequestDispatcher rd = request.getRequestDispatcher("update.jsp");
		rd.forward(request,response);
	}else{
		out.println("<center><h1>没有找到id为"+id+"的人员记录</h1></center>");
	}
}catch(SQLException e){
	e.printStackTrace();
}finally{
	try{
		rs.close();
		st.close();
		con.close();
	}catch (SQLException e){
		e.printStackTrace();
	}
}
%>
<font size=3 color=yellow>
<a href=infor.jsp>返回预案编译人员页面</a>
<br>
<a href=infor2.jsp>返回普通用户页面</a>
<br>
<a href=main.jsp>返回主页面</a>
</font>
</body>
</html>